package com.yue.lin.service;

import com.yue.lin.domain.Permission;
import com.yue.lin.repository.PermissionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
@CacheConfig(cacheNames = "c1")
public class PermissionService {
    @Autowired
    private PermissionRepository permissionRepository;

    @Cacheable(key = "#uid")
    public List<Permission> allPermissionByUid(String uid) {
        List<Permission> list = permissionRepository.allPermissionByUid(uid);
        return list;
    }

    @CacheEvict(key = "#uid")
    public void deleteCache(String uid){

    }

    public List<Permission> findAll() {
        return permissionRepository.findAll();
    }
}
